#ifndef TINX_LOCK_H
#define TINX_LOCK_H

#include <tinx/list.h>

typedef struct mutex_t
{
    u32 value;
    list_t waiters;
} mutex_t;

typedef struct lock_t
{
    struct task_t *holder;
    mutex_t mutex;
    u32 count;
} lock_t;

void lock_init(lock_t *lock);
void lock_acquire(lock_t *lock);
void lock_release(lock_t *lock);

#endif